<?php slot('sub', $sub); ?>
<?php slot('menu', $menu); ?>
<?php slot('user', $user); ?>
<link type="text/css" rel="stylesheet" href="/web/css/booking.css" />
<?php use_javascript('jquery-1.11.0.js') ?>
<?php use_javascript('booking.js') ?>

<div class="booking_center">
    <div class="booking_room_search"><div>Booking Room</div></div>
    <div class="booking_right_col">
        <div class="booking_left_col">

            <div class="booking_sub_left_col">
                <div class="booking_rooms">
                    <div class="booking_rooms_title"><div>Rooms</div></div>

                    <?php
                    $roomNumber = 0;
                    foreach ($info['Rooms'] as $r) {
                        foreach ($r as $room) {
                            $roomNumber++;
                            echo '<div class="booking_rooms_description" token="' . $room['SearchResult']['token'] . '" room_id="' . $room['id'] . '">'
                            . '<ul><li>Room ' . $roomNumber . '</li><li>|</li><li>' . $room['name'] . '</li><li>|</li><li></li></ul></div>'
                            . '<div class="booking_room_guest">'
                            . '<label for="booking_room_quest_status">Guest</label><select class="booking_room_quest_status"><option>Mr.</option><option>Mrs.</option>'
                            . '</select><input type="text" class="booking_room_guest_first_name" placeholder="First name">'
                            . '<input type="text" class="booking_room_guest_second_name" placeholder="Second name">'
                            . '<input type="text" class="booking_room_quest_passport" placeholder="Passport ID">'
                            . '<div class="booking_room_separator"></div></div>'
                            . '<div class="booking_room_data">'
                            . '<div class="booking_room_rows"><div class="booking_room_board"><div class="booking_room_board_title">Board Basic:</div><div class="booking_room_board_selected">Bed & Breakfast</div></div>'
                            . '<div class="booking_room_update"><div>Update to:</div><select><option value="1">Board Basic</option><option value="2">Full Board</option><option value="3">Room Only</option><option value="4">Half Board</option></select></div>'
                            . '<div class="booking_room_smoke"><div class="booking_room_smoke_title">Smoking Preference:</div><div class="booking_room_smoke_radio"><label>Smoking</label>
                                    <input type="radio" name="group1" value="true"><label>No Smoking</label><input type="radio" name="group1" value="false" checked></div></div>'
                            . '<div class="booking_room_bed"><div class="booking_room_bed_title">Bed Preference:</div><div class="booking_room_bed_radio">
                                    <label>One<input type="radio" name="group2" value="true" checked></label><label>Two<input type="radio" name="group2" value="false"></label></div>'
                            . '</div></div></div>';
                        }
                    }
                    ?>

                    <div class="booking_rooms_description">
                        <ul>
                            <li>Special Condition:</li>
                        </ul>
                    </div>

                    <p class="booking_special_condition_text">
                        Please note that, according to Israeli tax law, all hotels costs quoted for tourists are exempt of VAT.
                        Israelis however, will be subject to 18% VAT, so 18% must be added to the hotel bill (rooms and meals) for all Israeli quests should you have some.
                        Guests who enter Israel using their foreign passport, under VIsa entry B2/B3 (Regular tourist visas) and their stay is less
                        than 90 days, will not be charged VAT on their hotel bill.
                    </p>

                    <div class="booking_rooms_checkbox">
                        <input type="checkbox" class="booking_rooms_special_checkbox">
                        <p class="booking_special_condition_p">Tick here to confirm that you understand and agree to the special condition.</p>
                    </div>

                    <div class="booking_rooms_description">
                        <ul>
                            <li>Terms & Condition:</li>
                        </ul>
                    </div>

                    <div class="booking_rooms_checkbox">
                        <input type="checkbox" class="booking_rooms_terms_checkbox">
                        <p class="booking_terms_condition_p">Tick here to confirm that you have read and accepted our Terms and Conditions before submitting your booking.</p>
                    </div>

                    <div class="booking_rooms_description">
                        <ul>
                            <li>Cancellation Policy:</li>
                        </ul>
                    </div>

                    <div class="booking_rooms_checkbox">
                        <input type="checkbox" class="booking_rooms_plicy_checkbox">
                        <p class="booking_policy_p">Please note that, according to Israeli tax law, all hotel costs quoted for tourists are exempt of VAT.
                            Israelis however, will be subject to 18% VAT, so 18% must be added to the hotel bill (rooms and meals) for all
                            Israeli quests should you have some.</p>
                    </div>

                </div>

                <div class="booking_rooms">
                    <div class="booking_rooms_title"><div>Payment</div></div>
                    <?php
                    if (count($payments) > 1) {
                        foreach ($payments as $pay) {
                            if ($pay['value'] == sbValues::PAYLOADS_BY_AGEND) {
                                echo '<div class="booking_payment_col">'
                                . '<div class="input_radio_div">'
                                . '<input type="radio" name="group_payment" value="' . $pay['value'] . '"/></div><h4>' . $pay['type'] . '</h4>'
                                . '<div class="booking_payment_locator_button">' . $pay['input'] . '</div></div>';
                            } else if ($pay['value'] == sbValues::PAYLOADS_BY_PHONE) {
                                echo '<div class="booking_payment_col">'
                                . '<div class="input_radio_div">'
                                . '<input type="radio" name="group_payment" value="' . $pay['value'] . '"/></div><h4>' . $pay['type'] . '</h4>'
                                . '<input type="text" value="' . $pay['input'] . '" readonly></div>';
                            } else if ($pay['value'] == sbValues::PAYLOADS_BY_BALANCE) {
                                echo '<div class="booking_payment_col">'
                                . '<div class="input_radio_div">'
                                . '<input type="radio" name="group_payment" value="' . $pay['value'] . '"/></div><h4>' . $pay['type'] . '</h4>'
                                . '<input type="text" value="' . $pay['input'] . '" readonly></div>';
                            } else {
                                echo '<div class="booking_payment_col">'
                                . '<div class="input_radio_div">'
                                . '<input type="radio" name="group_payment" value="' . $pay['value'] . '"/></div><h4>' . $pay['type'] . '</h4>'
                                . '</div>';
                            }
                        }

                        echo '<div class="booking_payment_col"><div class="booking_payment_button">Processed Payment</div></div>';
                    } else {
                        echo '<div class="booking_payment_col">'
                        . '<div class="input_radio_div">'
                        . '<input type="radio" name="group_payment" value="' . $payments[0]['value'] . '"/></div><h4>' . $payments[0]['type'] . '</h4>'
                        . '<div class="booking_payment_locator_button">' . $payments[0]['input'] . '</div>'
                        . '</div>'
                        . '<div class="booking_payment_col">'
                        . '<label>Or Login to other opportunities payment</label><div class="booking_payment_login"><a href="' . url_for('loginuser') . '">Login</a></div></div>';
                    }
                    ?>
                </div>

                <!--                <div class="booking_payment_col">
                                        <div class="input_radio_div">
                                            <input type="radio" name="group_payment" value="paypal"/>
                                        </div>
                                        <h4>PayPal</h4>
                                    </div>
                                    <div class="booking_payment_col">
                                        <div class="input_radio_div">
                                            <input type="radio" name="group_payment" value="credit"/>
                                        </div>
                                        <h4>Credit card</h4>
                                    </div>
                                    <div class="booking_payment_col">
                                        <div class="input_radio_div">
                                            <input type="radio" name="group_payment" value="call"/>
                                        </div>
                                        <h4>By Phone - Call to Phone number +972 3 510 90 40</h4>
                                    </div>
                                    <div class="booking_payment_col">
                                        <div class="input_radio_div">
                                            <input type="radio" name="group_payment" value="balance"/>
                                        </div>
                                        <h4>From Your Balance</h4>
                                    </div>
                                    <div class="booking_payment_col">
                                        <div class="booking_payment_button">Processed Payment</div>
                                    </div>-->

            </div>

            <?php
            $image = $info['photo'];
            if (is_null($image)) {
                $image = '../uploads/no_image.png';
            } else {
                $image = explode(';', $image);
                $image = $image[0];
            }

            $stars = array(
                '/web/images/icoStar.png',
                '/web/images/icoStars2.png',
                '/web/images/icoStars3.png',
                '/web/images/icoStars4.png',
                '/web/images/icoStars5.png'
            );
            ?>
            <div class="booking_sub_right_col">
                <div class="booking_hotel_info">
                    <div class="bkhi_title" hotel_id="<?php echo $info['id'] ?>"><div>Hotel Information</div></div>
                    <div class="bkhi_image_container">
                        <div class="bkhi_image"><img src="<?php echo $image ?>"></div>
                        <div class="bkni_name"><?php echo $info['name_en'] ?></div>
                        <?php
                        if ($info['stars'] > 0) {
                            echo '<div class="bkni_stars"><img src="' . $stars[$info['stars'] - 1] . '"/></div>';
                        } else {
                            echo '<div class="bkni_stars"></div>';
                        }
                        ?>
                    </div>
                    <div class="bkhi_address"><?php echo $info['address'] ?></div>
                    <hr>
                    <div class="bkhi_short_description">
                        Please note that, according to Israeli tax law, all hotel costs quoted for tourists are exempt of VAT.
                        Israelis however, will be subject to 18% VAT, so 18% must be added to the hotel bill (rooms and meals) for all
                        Israeli quests should you have some.
                    </div>
                    <div class="bkhi_arrow_description"><img src="/web/images/arrow_down.png"></div>
                    <div class="bkhi_full_description">
                        Please note that, according to Israeli tax law, all hotel costs quoted for tourists are exempt of VAT.
                        Israelis however, will be subject to 18% VAT, so 18% must be added to the hotel bill (rooms and meals) for all
                        Israeli quests should you have some.
                    </div>
                </div>

                <div class="booking_hotel_info">
                    <div class="bkhi_title"><div>Reservation Details</div></div>
                    <div class="bkhi_check_in">
                        <label for="booking_check_in_input">Check in</label>
                        <input type="text" id="booking_check_in_input" readonly value="<?php echo $date['in'] ?>">
                        <img src="/web/images/icoCalendar.png"/>
                    </div>

                    <div class="bkhi_check_out">
                        <label for="booking_check_out_input">Check out</label>
                        <input type="text" id="booking_check_out_input" readonly value="<?php echo $date['out'] ?>">
                        <img src="/web/images/icoCalendar.png"/>
                    </div>

                    <div class="bkhi_check_night">
                        <label for="booking_check_input_night">Night</label>
                        <input type="text" id="booking_check_input_night" readonly value="<?php echo $date['days'] ?>">
                    </div>

                    <!--                    <div class="bkhi_check_guest">
                                            <label for="booking_check_input_guest">Guest</label>
                                            <input type="text" id="booking_check_input_guest">
                                        </div>-->

                    <hr>

                    <div class="bkhi_total_container">
                        <div class="bkhi_total_label">TOTAL</div>
                        <div class="bkhi_total_sum" price='<?php echo $price; ?>'><?php echo $price; ?>$</div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<div id="show_loader">
    <img src="http://azusdex.webcopo.com/web/images/301.gif">
    <h3>Please wait</h3>
</div>

<script>
    $(function() {
        $('.booking_payment_locator_button').click(function() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(
                        function(location) {
                            var latitude = location.coords.latitude;
                            var longitude = location.coords.longitude;

                            window.location.assign(urlBackend + 'agents/lt/' + latitude + '/ln/' + longitude);
                        },
                        function() {
                            var latitude = 32.07662;
                            var longitude = 34.787466;

                            window.location.assign(urlBackend + 'agents/lt/' + latitude + '/ln/' + longitude);
                        });
            } else {
                var latitude = 32.07662;
                var longitude = 34.787466;

                window.location.assign(urlBackend + 'agents/lt/' + latitude + '/ln/' + longitude);
            }
        });
    });
</script>
<!--                    <div class="booking_room_guest">
                        <label for="booking_room_quest_status">Guest</label>
                        <select class="booking_room_quest_status">
                            <option>Mr.</option>
                            <option>Mrs.</option>
                        </select>
                        <input type="text" class="booking_room_guest_first_name" placeholder="First name">
                        <input type="text" class="booking_room_guest_second_name" placeholder="Second name">
                        <label for="booking_room_guest_age_input">Age</label>
                        <input type="text" class="booking_room_guest_age_input">
                        <label for="booking_room_quest_cot">Cot</label>
                        <select class="booking_room_quest_cot">
                            <option>Yes</option>
                            <option>No</option>
                        </select>
                        <div class="booking_room_separator"></div>
                    </div>-->

<!--<div class="booking_room_data">
                        <div class="booking_room_rows">
                            <div class="booking_room_board">
                                <div class="booking_room_board_title">Board Basic:</div>
                                <div class="booking_room_board_selected">Bed & Breakfast</div>
                            </div>
                            <div class="booking_room_update">
                                <div>Update to:</div>
                                <select>
                                    <option>Full Board</option>
                                    <option>Room Only</option>
                                    <option>Half Board</option>
                                </select>
                            </div>
                            <div class="booking_room_smoke">
                                <div class="booking_room_smoke_title">Smoking Preference:</div>
                                <div class="booking_room_smoke_radio">
                                    <label>Smoking</label>
                                    <input type="radio" name="group1" value="true">
                                    <label>No Smoking</label>
                                    <input type="radio" name="group1" value="false" checked> 

                                </div>
                            </div>
                            <div class="booking_room_bed">
                                <div class="booking_room_bed_title">Bed Preference:</div>
                                <div class="booking_room_bed_radio">
                                    <label>One
                                        <input type="radio" name="group2" value="true">
                                    </label>
                                    <label>Two
                                        <input type="radio" name="group2" value="false" checked> 
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>-->